package com.ruoyi.web.controller.open;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

/**
 * @author wux
 * @date 2023/7/11 14:15
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResultDevice {
    private int code;

    private String token;

    private int validity;

    public static ResultDevice ok() {
        ResultDevice resultDevice = new ResultDevice();
        resultDevice.setCode(0);
        return resultDevice;
    }

    public static ResultDevice ok(String token, int validity) {
        ResultDevice resultDevice = new ResultDevice();
        resultDevice.setCode(0);
        resultDevice.setToken(token);
        resultDevice.setValidity(validity);
        return resultDevice;
    }

    public static ResultDevice error(int code) {
        ResultDevice resultDevice = new ResultDevice();
        resultDevice.setCode(code);
        return resultDevice;
    }

}
